package com.triadsystems.cashweb.modelo.persistencia.entidades;

import java.math.BigDecimal;
import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import lombok.Getter;
import lombok.Setter;

import com.triadsystems.cashweb.modelo.persistencia.enums.StatusCaixaEnum;

@Entity
@Table 
@SequenceGenerator(name="seq_caixa", sequenceName="cw_seq_caixa", initialValue = 1, allocationSize = 1)
public class Caixa extends ValueObject {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Id
	@Column
	@GeneratedValue(generator="seq_caixa", strategy=GenerationType.SEQUENCE)
	@Getter @Setter
	private Long entityId;
	
	@Getter @Setter
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar dataAbertura = Calendar.getInstance();
	
	@Getter @Setter
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar dataFechamento =  Calendar.getInstance();;
	
	@Getter @Setter
	@ManyToOne(targetEntity = Filial.class, optional=false)
	private Filial filial;
	
	@Getter @Setter
	private Integer qtdOperacao = 0 ;

	@Getter @Setter
	private Integer qtdEstorno = 0 ;
	
	@Getter @Setter
	private Integer qtdRetirada = 0;

	@Getter @Setter
	private Integer qtdDevolucao = 0;

	@Getter @Setter
	private Integer qtdDinheiro = 0;
	
	@Getter @Setter
	private Integer totalDocumentos = 0;

	@Getter @Setter
	private BigDecimal debitoAcumulado = BigDecimal.ZERO;

	@Getter @Setter
	private BigDecimal dinheiroAcumulado = BigDecimal.ZERO;
	
	@Getter @Setter
	private BigDecimal creditoAcumulado = BigDecimal.ZERO;

	@Getter @Setter
	private BigDecimal retiradaAcumulado = BigDecimal.ZERO;
	
	@Getter @Setter
	private BigDecimal devolucaoAcumulado = BigDecimal.ZERO;

	@Getter @Setter
	private BigDecimal estornoAcumulado = BigDecimal.ZERO;
	
	@Getter @Setter
	private BigDecimal valorInicial = BigDecimal.ZERO;
	
	@Getter @Setter
	private BigDecimal valorLiquido = BigDecimal.ZERO;
	
	@Getter @Setter
	@Enumerated
	private StatusCaixaEnum tipoStatusCaixa;
	
	@Getter @Setter
	@ManyToOne
	private Usuario usuario;
	
}
